---
layout: post
title: "How To Setup A Web-Server in fedora/Ubuntu"
date: 2011-12-01
comments: false
categories:
 - operating systems
 - latest
---

<div class='post'>
This is the first self-help guide to configure your web server in an Ubuntu/fedora. Only the very basic and initial server config will be dealt in this post.Subsequent post will have the advanced stuffs.<br/><br/>First inorder to configure your system to act as a web-server, the best and most favourable thing u can do is that you install the server installation repos initially.If you are installing fedora from a dvd, they give you four options and you should select the server option.So that your OS is already optimized to be a server.And don’t worry it will be having all the stuff you need in a graphical desktop.<br/><br/>Here are the steps you need to follow once you are connected to an internet connection with decent speed.<br/><br/>Any server in Linux is based on LAMP.<br/><br/>Its works as good as any xampp server you have used in Windows.Though you need to have some basic understanding of permissions in Linux.<br/><br/>To install MySQL5, you need to do this:<br/>yum install mysql mysql-server<br/><br/>Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:<br/><br/>chkconfig --levels 235 mysqld on<br/><br/><br/>/etc/init.d/mysqld start<br/>Run<br/>mysql_secure_installation<br/>to set a password for the user root (otherwise anybody can access your MySQL database!):<br/>[root@server1~]# mysql_secure_installation<br/><br/><br/><br/><br/><br/><br/>NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL<br/><br/>SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!<br/><br/><br/><br/><br/><br/>In order to log into MySQL to secure it, we'll need the current<br/><br/>password for the root user. If you've just installed MySQL, and<br/><br/>you haven't set the root password yet, the password will be blank,<br/><br/>so you should just press enter here.<br/><br/>Enter current password for root (enter for none): &lt;-- ENTER<br/><br/>OK, successfully used password, moving on...<br/><br/><br/><br/>Setting the root password ensures that nobody can log into the MySQL<br/><br/>root user without the proper authorisation.<br/><br/><br/>Set root password? [Y/n] &lt;-- ENTER<br/><br/>New password: &lt;-- yourrootsqlpassword<br/><br/>Re-enter new password: &lt;-- yourrootsqlpassword<br/><br/>Password updated successfully!<br/><br/>Reloading privilege tables..<br/><br/>... Success!<br/><br/><br/><br/><br/><br/>By default, a MySQL installation has an anonymous user, allowing anyone<br/><br/><br/>to log into MySQL without having to have a user account created for<br/><br/>them. This is intended only for testing, and to make the installation<br/><br/>go a bit smoother. You should remove them before moving into a<br/><br/>production environment.<br/><br/>Remove anonymous users? [Y/n] &lt;-- ENTER<br/><br/>... Success!<br/><br/><br/><br/>Normally, root should only be allowed to connect from 'localhost'. This<br/><br/>ensures that someone cannot guess at the root password from the network.<br/><br/><br/>Disallow root login remotely? [Y/n] &lt;-- ENTER<br/><br/>... Success!<br/><br/><br/><br/>By default, MySQL comes with a database named 'test' that anyone can<br/><br/><br/>access. This is also intended only for testing, and should be removed<br/><br/>before moving into a production environment.<br/><br/><br/>Remove test database and access to it? [Y/n] &lt;-- ENTER<br/><br/>- Dropping test database...<br/><br/>... Success!<br/><br/><br/>- Removing privileges on test database...<br/><br/>... Success!<br/><br/><br/>This is the first self-help guide to configure your web server in an Ubuntu/fedora. Only the very basic and initial server config will be dealt in this post.Subsequent post will have the advanced stuffs.<br/><br/>First inorder to configure your system to act as a web-server, the best and most favourable thing u can do is that you install the server installation repos initially.If you are installing fedora from a dvd, they give you four options and you should select the server option.So that your OS is already optimized to be a server.And don’t worry it will be having all the stuff you need in a graphical desktop.<br/><br/>Here are the steps you need to follow once you are connected to an internet connection with decent speed.<br/><br/>Any server in Linux is based on LAMP.<br/><br/>Its works as good as any xampp server you have used in Windows.Though you need to have some basic understanding of permissions in Linux.<br/><br/>To install MySQL5, you need to do this:<br/>yum install mysql mysql-server<br/><br/>Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:<br/><br/>chkconfig --levels 235 mysqld on<br/><br/><br/>/etc/init.d/mysqld start<br/>Run<br/>mysql_secure_installation<br/>to set a password for the user root (otherwise anybody can access your MySQL database!):<br/>[root@server1~]# mysql_secure_installation<br/><br/><br/><br/><br/><br/><br/>NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL<br/><br/>SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!<br/><br/><br/><br/><br/><br/>In order to log into MySQL to secure it, we'll need the current<br/><br/>password for the root user. If you've just installed MySQL, and<br/><br/>you haven't set the root password yet, the password will be blank,<br/><br/>so you should just press enter here.<br/><br/>Enter current password for root (enter for none): &lt;-- ENTER<br/><br/>OK, successfully used password, moving on...<br/><br/><br/><br/>Setting the root password ensures that nobody can log into the MySQL<br/><br/>root user without the proper authorisation.<br/><br/><br/>Set root password? [Y/n] &lt;-- ENTER<br/><br/>New password: &lt;-- yourrootsqlpassword<br/><br/>Re-enter new password: &lt;-- yourrootsqlpassword<br/><br/>Password updated successfully!<br/><br/>Reloading privilege tables..<br/><br/>... Success!<br/><br/><br/><br/><br/><br/>By default, a MySQL installation has an anonymous user, allowing anyone<br/><br/><br/>to log into MySQL without having to have a user account created for<br/><br/>them. This is intended only for testing, and to make the installation<br/><br/>go a bit smoother. You should remove them before moving into a<br/><br/>production environment.<br/><br/>Remove anonymous users? [Y/n] &lt;-- ENTER<br/><br/>... Success!<br/><br/><br/><br/>Normally, root should only be allowed to connect from 'localhost'. This<br/><br/>ensures that someone cannot guess at the root password from the network.<br/><br/><br/>Disallow root login remotely? [Y/n] &lt;-- ENTER<br/><br/>... Success!<br/><br/><br/><br/>By default, MySQL comes with a database named 'test' that anyone can<br/><br/><br/>access. This is also intended only for testing, and should be removed<br/><br/>before moving into a production environment.<br/><br/><br/>Remove test database and access to it? [Y/n] &lt;-- ENTER<br/><br/>- Dropping test database...<br/><br/>... Success!<br/><br/><br/><br/>Reloading the privilege tables will ensure that all changes made so far<br/><br/>will take effect immediately.<br/><br/><br/><br/>Reload privilege tables now? [Y/n] &lt;-- ENTER<br/><br/>... Success!<br/><br/><br/>Cleaning up...<br/><br/><br/><br/><br/><br/>All done! If you've completed all of the above steps, your MySQL<br/><br/>installation should now be secure.<br/><br/>Thanks for using MySQL!<br/><br/>[root@server1~]#<br/><br/>Since you have installed the server edition,Apacche will be installed by default,if not install using following commands.( Yum install httpd or Sudo apt-get install httpd)<br/>Also u need to add install apache too.To do so you need to type these in terminal<br/><br/>yum install httpd<br/><br/>then if u want your system to start this service at startup you need to type this.<br/><br/>chkconfig --levels 235 httpd on<br/><br/>and you can start apache by<br/><br/>service httpd start or /etc/init.d/httpd start<br/><br/>To install PHP5 you need to type<br/><br/>yum install php<br/><br/>and then restart the server by service httpd restart<br/><br/>To get Mysql support in PHP5 you need to type<br/><br/>yum search php and then<br/><br/>yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tid<br/><br/>And then again restart the apache2.<br/><br/>Now to install PHPMyadmin<br/><br/>You need to use these commands<br/><br/>yum install phpmyadmin and then we need to configure phpmyadmin to accept connections from other than localhost for that you can<br/><br/>use either vi /etc/httpd/conf.d/phpMyAdmin.conf or gedit /etc/httpd/conf.d/phpMyAdmin.conf or nano etc/httpd/conf.d/phpMyAdmin.conf<br/><br/>Now all u need to do is to comment out out the  stanza):<br/><br/>Once you are done with this you are good to go.Now go into terminal,Login as root and type init 6 so as to restart your computer so as changes takes effect<br/><br/>and then you do the following steps.<br/><br/>Check out whether the apache and mysql are running or not by typing<br/><br/>service httpd status and service mysql status.<br/><br/>If the are running go to your browser and type localhost /<a href="http://127.0.0.1/">127.0.0.1</a><br/><br/>you would see you server running as u can get a apache page.<br/><br/>Now you can put your site files or wordpress/joomla/drupal cms in /etc/html/www<br/><br/>and follow the installation steps.<br/><br/>Note: you need to be root to do most of the steps. ubuntu user can replace yum with sudo apt-get in all these commands.<br/><br/>Once you have experience in all these stuffs you can install using a single line.But here this is elaborated and detailed so that you may understand the components you have installed.<br/><br/>Any problems if any can be posted .</div>
<h2>Comments</h2>
<div class='comments'>
<div class='comment'>
<div class='author'>Installing wordpress CMS on your server | mytechsearch</div>
<div class='content'>
[...] How To Setup A Web-Server in fedora/Ubuntu (gotchacode.wordpress.com) [...]</div>
</div>
<div class='comment'>
<div class='author'>Installing wordpress CMS on your server | Mytechsearch</div>
<div class='content'>
[...] How To Setup A Web-Server in fedora/Ubuntu (gotchacode.wordpress.com) [...]</div>
</div>
</div>
